/**
 * Project Reactor
 */


#ifndef _TCPCONNECTION_H
#define _TCPCONNECTION_H
#include "SocketIO.h"
#include <string>
#include <iostream>
#include "Socket.h"
#include "InetAddress.h"
#include <sstream>

using std::ostringstream;
using std::cout;
using std::endl;
using std::string;

class TcpConnection {
private:
    SocketIO m_sockIO;
    Socket m_socket;
    InetAddress m_local_addr;
    InetAddress m_peer_addr;

    InetAddress getLocalAddr();
    InetAddress getPeerAddr();
public: 
/**
 * @param fd
 */
explicit TcpConnection(int fd);
    
~TcpConnection();
    
string receive();
    
/**
 * @param msg
 */
void send(const string & msg);
string streamToString();
};


#endif //_TCPCONNECTION_H